package hbec.kettle.etl.engine.schedule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import hbec.kettle.etl.common.plugin.PluginStatus;
import hbec.kettle.etl.engine.conf.ReaderConf;
import hbec.kettle.etl.plugins.reader.mysqlreader.MysqlReader;

public class ReaderWorker extends PluginWorker implements Runnable {
	private static final Logger logger = LoggerFactory.getLogger(ReaderWorker.class);
	
	private ReaderConf readerConf;

	public ReaderWorker(ReaderConf readerConf) {
		this.readerConf = readerConf;
	}
	
	@Override
	public void run() {
		logger.info(readerConf.getWatchSumTablesOfDb().keySet() + " reader thread startup");
		
		MysqlReader mysqlReader = new MysqlReader();
		if (mysqlReader.prepare(readerConf) == PluginStatus.SUCCESS.value()) 
			mysqlReader.startRead();
	}
}
